﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleRest.Core.Exceptions
{
    /// <summary>
    /// General web exception which can be thrown within SimpleRest services for error code and status code propigation.
    /// </summary>
    public class WebException : WebExceptionBase
    {
        public WebException()
            : base() { }
        public WebException(System.Net.HttpStatusCode statusCode)
            :this()
        {
            this._statusCode = statusCode;
        }
        public WebException(string errorCode)
            : this()
        {
            this._errorCode = errorCode;
        }
        public WebException(System.Net.HttpStatusCode statusCode, string errorCode)
            : this()
        {
            this._statusCode = statusCode;
            this._errorCode = errorCode;
        }

        private System.Net.HttpStatusCode _statusCode = System.Net.HttpStatusCode.InternalServerError;
        public override System.Net.HttpStatusCode StatusCode
        {
            get
            {
                return _statusCode;
            }
        }

        private string _errorCode = "";
        public override string ErrorCode
        {
            get
            {
                return _errorCode;
            }
        }
    }
}
